import actionTypes from '../action'
import { checkHundred } from './rules'
export default {
  [actionTypes.COMMISSION_MANAGE]: {
    title: '佣金设置',
    form: [
      {
        type: 'select',
        label: '省份',
        prop: 'provinceCode',
        cascader: 'cityCode',
        placeholder: '请选择省份',
        option(_, $store) {
          return $store.getters['dic/province']
        },
        auto_dispatch: 'dic/getCityDic',
        rule: { required: true, message: '省份不能为空', trigger: ['blur', 'change'] }
      },
      {
        type: 'select',
        label: '城市',
        prop: 'cityCode',
        placeholder: '请选择城市',
        option(_, $store) {
          return $store.getters['dic/city']
        },
        dispatch: 'dic/getCity',
        rule: { required: true, message: '城市不能为空', trigger: ['blur', 'change']}
      },
      {
        type: 'sub-number',
        label: '佣金比例',
        prop: 'percentage',
        placeholder: '请输入佣金比例',
        rule: { required: true, validator: checkHundred, trigger: ['blur', 'change'] },
        option() {
          return '%'
        }
      }
    ]
  }
}
